package cn.birdbaby.plugins;

import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NlsContexts;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.refactoring.ClassRefactoringHandlerBase;
import com.intellij.refactoring.rename.RenameDialog;

/**
 * @author llorando 3/8/24 3:18 pm
 */
public class MyRenameHandler extends ClassRefactoringHandlerBase {

    @Override
    protected boolean acceptsElement(PsiElement element) {
        return element instanceof PsiClass;
    }

    @Override
    protected void showDialog(Project project, PsiElement element, Editor editor, PsiFile file, DataContext dataContext) {
        RenameDialog renameDialog = new RenameDialog(project, element, null, editor);
        renameDialog.show();
    }

    @Override
    protected String getHelpId() {
        return null;
    }

    @Override
    protected @NlsContexts.DialogTitle String getTitle() {
        return "test";
    }

    @Override
    protected @NlsContexts.DialogMessage String getInvalidPositionMessage() {
        return null;
    }

}
